-
Notifications
You must be signed in to change notification settings - Fork 8k
usb: device_next: Add USB MTP class support #86832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Dear Reviewers: Could you please help me validate the current architecture first, then we can move to final polishing when I get the PR out of draft state. Thanks a lot. |
7874f45
to
748eb7e
Compare
f6bfa5e
to
02a2fb9
Compare
The class fixup/polishing commits should be squashed together into the main MTP class implementation commit. Sample changes should go into separate commits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements basic USB MTP class support to enable file and directory transfers between a device and a host. Key changes include:
- Adding a new MTP class header with necessary function declarations and context structure.
- Providing a sample application to test and demonstrate the MTP functionality.
- Updating USB descriptors, DTS bindings, and sample configuration to support MTP.
Reviewed Changes
Copilot reviewed 7 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
subsys/usb/device_next/class/usbd_mtp_class.h | Introduces declarations for the USB MTP class support |
samples/subsys/usb/mtp/src/main.c | Implements a sample application to test the MTP class driver |
samples/subsys/usb/mtp/sample.yaml | Adds a sample configuration for the MTP device class |
include/zephyr/usb/usb_ch9.h | Updates USB descriptors to include the MTP image class type |
dts/bindings/fs/zephyr,fstab-common.yaml | Adds a filesystem binding property for enabling MTP file access |
Files not reviewed (11)
- samples/subsys/usb/mtp/CMakeLists.txt: Language not supported
- samples/subsys/usb/mtp/Kconfig: Language not supported
- samples/subsys/usb/mtp/README.rst: Language not supported
- samples/subsys/usb/mtp/boards/rpi_pico.overlay: Language not supported
- samples/subsys/usb/mtp/boards/stm32f769i_disco.overlay: Language not supported
- samples/subsys/usb/mtp/prj.conf: Language not supported
- subsys/usb/device_next/CMakeLists.txt: Language not supported
- subsys/usb/device_next/class/Kconfig: Language not supported
- subsys/usb/device_next/class/Kconfig.mtp: Language not supported
- tests/subsys/usb/device_next/build_all.conf: Language not supported
- tests/subsys/usb/device_next/build_all.overlay: Language not supported
6694e76
to
ce9c991
Compare
3bb7378
to
9910433
Compare
Rebase update:
|
@nashif @tmon-nordic any idea why |
7e6e742
to
29c6bac
Compare
Hello, First, I had to increase CONFIG_USBD_THREAD_STACK_SIZE to 4096 not to get stack overflows.
Using a debugger, I traced it to the line
I'm not export in the usb protocol so not really sure what to test now. |
@DenisD3D Thanks for your feedback. |
I think you forgot to attach the actual kconfig values :) |
Sorry 🤦, here you go
|
Hello, |
Hi @ExtremeGTX, did you had time to take a look on this ? Thanks |
29c6bac
to
4970eba
Compare
|
Hi @DenisD3D But I have added 2 things with latest push
|
Thanks for the new version! |
Denis helped me find some compatibility issues with Linux, I'm working on them along with some improvements. |
Any news? |
Thread safety so far completely missing from what I can tell |
4970eba
to
55437ca
Compare
Changes:
|
55437ca
to
69ab47c
Compare
Implement a basic version of USB MTP (Media transfer protocol) class which support the necessary MTP commands to handle Dir/file transfer between a device and host. Signed-off-by: Mohamed ElShahawi <[email protected]>
69ab47c
to
7152b61
Compare
Add a sample application that demonstrates how to use the new USB MTP device class. This shows how to set up the device tree to expose storage partitions to a host over USB using MTP. Files/Dirs can be accessed from host without host supportfor the underlying filesystem like littlefs. Signed-off-by: Mohamed ElShahawi <[email protected]>
7152b61
to
a031a76
Compare
|
For Linux users: whenever you face a problem, please try to reproduce with logs enabled by following these steps:
|
Implement a basic version of USB MTP (Media transfer protocol) class which support
the necessary MTP commands to handle Dir/file transfer between a device and host.
Fixes: #54468
TODO:
MAX_PACKET_SIZE
value dependent on whether USB is HS/FSThanks:
device_next
works